const Router = require("koa-router");

const {
  verifyAuth,
  verifyAdminPermission,
} = require("../middleware/auth.middleware");

const {
  create,
  detail,
  list,
  update,
  remove,
  productType,
} = require("../controller/product.controller.js");

const productRouter = new Router({ prefix: "/product" });

productRouter.post("/", verifyAuth, verifyAdminPermission, create);
productRouter.get("/", list);
productRouter.get("/:productId", detail);
productRouter.patch("/:productId", verifyAuth, verifyAdminPermission, update);
productRouter.delete("/:productId", verifyAuth, verifyAdminPermission, remove);
productRouter.post("/productType", verifyAuth, productType);

module.exports = productRouter;
